#encoding:utf8
import storageconnector

class ConnectorSet(object):
    def __init__(self, addresses):
        self.addresses = addresses
        self.connectorSet = []
        self.__Connect()
        
    def __Connect(self):
        for address in self.addresses:
            connector = storageconnector.StorageConnector()
            connector.Connect(address.host, 6666)
            self.connectorSet.append(connector)
            
    def Close(self):
        for c in self.connectorSet:
            c.Close()
            
    def Write(self, blockId, data):
        for c in self.connectorSet:
            c.Write(blockId, data)